<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd">
	<namespaces>
		<Namespace>
			<prefix>gml</prefix>
			<uri>http://www.opengis.net/gml</uri>
		</Namespace>
		<Namespace>
			<prefix>gsml</prefix>
			<uri>urn:cgi:xmlns:CGI:GeoSciML:2.0</uri>
		</Namespace>
		<Namespace>
			<prefix>xlink</prefix>
			<uri>http://www.w3.org/1999/xlink</uri>
		</Namespace>
	</namespaces>	
	
	<sourceDataStores>
		<DataStore>
			<id>postgisng</id>
			<parameters>
				<Parameter>
					<name>dbtype</name>
					<value>${dbtype}</value>
				</Parameter>
				<Parameter>
					<name>host</name>
					<value>${host}</value>					
				</Parameter>
				<Parameter>
					<name>port</name>
					<value>${port}</value>					
				</Parameter>
				<Parameter>
					<name>database</name>
					<value>${database}</value>					
				</Parameter>
				<Parameter>
					<name>user</name>
					<value>${user}</value>					
				</Parameter>
				<Parameter>
					<name>passwd</name>
					<value>${passwd}</value>					
				</Parameter>
				<Parameter>
					<name>schema</name>
					<value>geosciml</value>
				</Parameter>
			</parameters>
		</DataStore>
		<DataStore>
			<id>Oracle</id>
			<parameters>
				<Parameter>
					<name>dbtype</name>
					<value>${dbtype}</value>
				</Parameter>
				<Parameter>
					<name>host</name>
					<value>${host}</value>					
				</Parameter>
				<Parameter>
					<name>port</name>
					<value>${port}</value>					
				</Parameter>
				<Parameter>
					<name>database</name>
					<value>${database}</value>					
				</Parameter>
				<Parameter>
					<name>user</name>
					<value>${user}</value>					
				</Parameter>
				<Parameter>
					<name>passwd</name>
					<value>${passwd}</value>					
				</Parameter>				
			</parameters>
		</DataStore>
	</sourceDataStores>
	<includedTypes>
		<Include>GE_CGITermValue.xml</Include>			
	</includedTypes>
	<catalog>../../../schemas/catalog.xml</catalog>
	<targetTypes>
		<FeatureType>
			<schemaUri>http://www.geosciml.org/geosciml/2.0/xsd/geosciml.xsd</schemaUri>
		</FeatureType>
	</targetTypes>	 
	<typeMappings>		
		<FeatureTypeMapping>
			<sourceDataStore>${dbtype}</sourceDataStore>
			<sourceType>geologicevent</sourceType>
			<targetElement>gsml:GeologicEvent</targetElement>			
			<attributeMappings>
				<AttributeMapping>
					<targetAttribute>
                        gsml:GeologicEvent
					</targetAttribute>
					<idExpression>
						<OCQL>full_id</OCQL>
					</idExpression>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>gsml:eventAge</targetAttribute>
					<targetAttributeNode>gsml:CGI_TermRangePropertyType</targetAttributeNode>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>
                        gsml:eventAge/gsml:CGI_TermRange/gsml:lower/gsml:CGI_TermValue/gsml:value
					</targetAttribute>
					<sourceExpression>
						<OCQL>minage</OCQL>						
					</sourceExpression>
					<ClientProperty>
						<name>codeSpace</name>
						<value>codespace</value>
					</ClientProperty>					
				</AttributeMapping>				
				<AttributeMapping>
					<targetAttribute>
                        gsml:eventAge/gsml:CGI_TermRange/gsml:upper/gsml:CGI_TermValue/gsml:value
					</targetAttribute>
					<sourceExpression>
						<OCQL>maxage</OCQL>						
					</sourceExpression>
					<ClientProperty>
						<name>codeSpace</name>
						<value>codespace</value>
					</ClientProperty>					
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>gsml:eventEnvironment</targetAttribute>
					<targetAttributeNode>gsml:CGI_TermValuePropertyType</targetAttributeNode>					
				</AttributeMapping>				
				<AttributeMapping>
					<targetAttribute>
                       gsml:eventEnvironment
					</targetAttribute>
					<sourceExpression>
						<OCQL>id</OCQL>	
						<linkElement>eventEnvironmentMapping</linkElement>
						<linkField>FEATURE_LINK</linkField>						
					</sourceExpression>						
					<isMultiple>true</isMultiple>	
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>
                       gsml:eventProcess
					</targetAttribute>
					<sourceExpression>
						<OCQL>id</OCQL>	
						<linkElement>eventProcessMapping</linkElement>
						<linkField>FEATURE_LINK</linkField>	
					</sourceExpression>
					<isMultiple>true</isMultiple>	
				</AttributeMapping>				
				<AttributeMapping>
					<targetAttribute>
                       FEATURE_LINK
					</targetAttribute>
					<sourceExpression>
						<OCQL>geologicalfeature_id</OCQL>						
					</sourceExpression>
				</AttributeMapping>
			</attributeMappings>
		</FeatureTypeMapping>			
	</typeMappings>
</as:AppSchemaDataAccess>
